﻿using GeneticSharp.Domain.Chromosomes;
using GeneticSharp.Domain.Fitnesses;
using GeneticSharpDemo.Data;

namespace GeneticSharpDemo
{
    internal class MSOSFitness : IFitness
    {
        DataManage DataManageInstance = DataManage.Instance;
        

        /// <summary>
        /// 根据编码计算任务排布方案
        /// 获取适应度
        /// </summary>
        /// <param name="chromosome"></param>
        /// <returns></returns>
        public double Evaluate(IChromosome chromosome)
        {
            var fitness = (double)1 / (((MSOSChromosome)chromosome).JobEndTimeMax + ((MSOSChromosome)chromosome).NotScheduleRecord.Count * 1080);
            return fitness;
        }
    }
}